def convert(s: str, n: int) -> str:
    ll = len(s)
    res = ""
    if n == 1:
        return s
    for i in range(n):
        if i == 0 or i == n - 1:
            j = i
            while j < ll:
                res += s[j]
                j += 2*n-2
        else:
            j = i
            k = 2*n-2-i
            while j < ll or k < ll:
                if j < ll:
                    res += s[j]
                if k < ll:
                    res += s[k]
                j += 2*n-2
                k += 2*n-2
    return res


print(convert('LEETCODEISHIRING', 3))
print('LCIRETOESIIGEDHN')

